const Mock = require('mockjs')

const housing = Mock.mock({
  'sellTower|250': [
    {
      name: '@ctitle',
      id: '@id',
      address: '@city(true)',
      rank: '50',
      'price|7000-45000': 1,
      updateTime: '@datetime("yyyy-MM-dd A HH:mm:ss")',
      status: '@boolean'
    }
  ],
  'tenement|279': [
    {
      name: '@ctitle',
      title: '小区' + '2室1厅' + '128' + '平',
      'price|2-100': 1,
      'acreage|65-156': 1,
      rank: 50,
      status: '@boolean',
      id: '@id'
    }
  ]

})

const { broker } = Mock.mock({
  'broker|35': [
    {
      name: '@cname',
      phoneNum: /^1[3-9]\d{9}$/,
      company: '链家地产',
      'newHouse|45-300': 1,
      'secondHouse|45-300': 1,
      'tenement|45-300': 1,
      status: /(在职|离职)/,
      id: '@id'
    }
  ]

})

const { information } = Mock.mock({
  'information|35': [
    {
      title: '@ctitle',
      name: '@cname',
      updateTime: '@datetime("yyyy-MM-dd A HH:mm:ss")',
      status: '@boolean',
      id: '@id'
    }
  ]

})

const { order } = Mock.mock({
  'order|35': [
    {
      id: '@id',
      name: '@cname',
      phoneNum: /^1[3-9]\d{9}$/,
      type: /(二手房出租|有房出租|我想买个房|我想租个房)/,
      'price|10-10000': 1,
      payTime: '@datetime("yyyy-MM-dd A HH:mm:ss")'
    }
  ]

})

const { live } = Mock.mock({
  'live|137': [
    {
      id: '@id',
      title: '@ctitle',
      name: '@cname',
      previewImg: 'https://unsplash.it/400/800/?@name',
      liveUrl: '@url("http", "baidu.com")',
      playbackUrl: '@url("http", "baidu.com")',
      status: '@boolean',
      isEnable: true,
      'hits|20-200000': 1,
      startTime: '@datetime("yyyy.MM.dd HH:mm:ss")',
      desc: {
        'jobNumber|+1': 10001,
        'sellGoodsNum|50-1089': 1,
        'viewsNumber|20-200000': 1,
        'saleroom|1000-100000': 1
      }
    }
  ]

})
const { audit } = Mock.mock({
  'audit|45': [
    {
      name: '@ctitle',
      title: '小区' + '2室1厅' + '128' + '平',
      'price|2-100': 1,
      recommend: '@boolean',
      'acreage|65-156': 1,
      rank: 50,
      status: /(待审核|审核通过|审核不通过)/,
      id: '@id'
    }
  ]

})

module.exports = {
  housing,
  broker,
  information,
  order,
  live,
  audit
}
